package triannon.client.util;

import triannon.client.settings.LevelProperties;

public class TMath {
	public static double gaussianBell(double mu, double sigma, double x) {
		double y;
		y = Math.exp(-Math.pow((x - mu) / sigma, 2) / 2)
				/ (sigma * Math.sqrt(2 * Math.PI));
		return y;
	}

	public static int gaussianBell(int mu, int sigma, int x) {
		return (int) gaussianBell((double) mu, (double) sigma, (double) x);
	}

	public static int toWorldCoorninates(int i) {
		return i * LevelProperties.getGridSize();
	}

	public static int toWorldCoorninatesCenter(int i) {
		return i * LevelProperties.getGridSize() + LevelProperties.getGridSize()
				/ 2;
	}

	public static int toLevelCoorninates(int i) {
		return i / LevelProperties.getGridSize();
	}

	public static int toGridCenter(int iWorld) {
		return toWorldCoorninates(toLevelCoorninates(iWorld))
				+ LevelProperties.getGridSize() / 2;
	}

}
